<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>极客科技管理系统</title>
    <span th:include="/common/common :: commonOnLoad"></span>
    <style>
        .login_div{
            position: absolute;
            top: 40%;
            left: 50%;
            -webkit-transform: translate(-50%, -50%);
            -moz-transform: translate(-50%, -50%);
            -ms-transform: translate(-50%, -50%);
            -o-transform: translate(-50%, -50%);
            transform: translate(-50%, -50%);
        }
    </style>
</head>
<body class="easyui-layout">
    <div class="login_div">
        <div class="easyui-panel" title="布衣管理系统" style="width:400px;padding:30px 60px">
            <form id="ff" method="post">
                <div style="margin-bottom:20px">
                    <label for="username">账号:</label>
                    <input class="easyui-textbox" type="text" name="username" id="username" style="width:100%;height:32px" data-options="iconCls:'icon-man',iconWidth:30">
                </div>
                <div style="margin-bottom:20px">
                    <label for="password">密码:</label>
                    <input class="easyui-textbox" type="password" name="password" style="width:100%;height:32px" data-options="iconCls:'icon-lock',iconWidth:30">
                </div>
                <div>
                    <a href="#" class="easyui-linkbutton c1" style="width:100%;height:32px" onclick="submitForm()" >登录</a>
                </div>
            </form>
        </div>
    </div>
    <script>

        $(document).keyup(function(event){
            if(event.keyCode ==13){
                if($("#username").val()!=null && $("#username").val()!=""){
                    submitForm();
                }
            }
        });

        function submitForm(){
            $('#ff').form('submit', {
                    url:ctxPath+"/login",
                onSubmit: function(){
            },
            success:function(data){
                if(data =="0"){
                    $.messager.alert('提示','用户名或密码错误！');
                }else if(data =="2"){
                    $.messager.alert('提示','该账号已被禁用，请联系管理员处理！');
                }else{
                    window.location.href=ctxPath+"main";
                }
            }
        });
        }
    </script>

</body>
</html>